package com.wsfk.ssm.action;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;

import sun.security.krb5.internal.PAEncTSEnc;

import com.wsfk.ssm.entity.User;
import com.wsfk.ssm.service.LoginSvc;
import com.wsfk.ssm.tools.BaseAction;
import com.wsfk.ssm.tools.Pagination;

/***
 * 
 * @author zhangbao
 * 登录的action
 */

@Controller("LoginAction")
public class LoginAction extends BaseAction{

	/**
	 * 
	 */
	private static final long serialVersionUID = 4053326186254248418L;

	private LoginSvc loginSvc;
	private User user;

	@Resource
	public void setLoginSvc(LoginSvc loginSvc) {
		this.loginSvc = loginSvc;
	}
	
	public void setUser(User user) {
		this.user = user;
	}
	
	public User getUser() {
		return user;
	}

	
	public String dologin(){
		
		User us = loginSvc.doLogin(user);
		setUser(us);
		if(us!=null){
			this.getSession().put("user", us);
			return SUCCESS;
		}else{
			return "tologin";
		}
	}
	
	
}
